package com.interpreter.self;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Client {

    public static void main(String[] args) {
        String expStr = getExpStr();
        HashMap<String, Integer> value = getValue(expStr);
        String exp = getExpStr();
        Calculator calculator = new Calculator();
        calculator.getEmulation(exp);
        int calculate = calculator.calculate(value);
        System.out.printf("计算出的结果%d\n",calculate);
    }

    public static HashMap<String,Integer> getValue(String expStr){
        HashMap<String,Integer> datas = new HashMap<>();
        char[] chars = expStr.toCharArray();
        int time=0;
        for(char str:chars){
            if (str!='+' && str!='-'){
                if(time==0) {
                    datas.put("a", str - 48);
                    time++;
                } else {
                    datas.put("b", str - 48);
                }
            }
        }
        return datas;
    }

    public static String getExpStr(){
        try {
            return new BufferedReader(new InputStreamReader(System.in)).readLine();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
